// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Gargoyle Shot Object
// Script Author: Christan Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 54 : TYPE_GARGOYLESHOT


// Static Values

// Tables

event ObjectMain
	object.xpos += object.xvel
	if object.xvel < 0
		ObjectTileCollision(CSIDE_RWALL, -8, 4, 0)
	else
		ObjectTileCollision(CSIDE_LWALL, 8, 4, 0)
	end if
	if checkResult == 1
		object.type = TypeName[Blank Object]
	end if
	if object.value0 < 16
		object.value0++
	else
		object.drawOrder = 3
	end if
	object.frame = oscillation
	object.frame >>= 3
	object.frame &= 1
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		BoxCollisionTest(C_TOUCH, object.entityPos, -4, -4, 4, 4, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
		if checkResult == 1
			CallFunction(PlayerObject_FireHit)
		end if
	next
end event


event ObjectDraw
	DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
end event


event ObjectStartup
	LoadSpriteSheet("LZ/Objects.gif")
	SpriteFrame(-8, -3, 15, 6, 127, 124)
	SpriteFrame(-8, -3, 15, 6, 127, 131)
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
